package constant.milk.cashbook.sms.parser;

import java.util.Calendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import constant.milk.cashbook.bean.SmsInputData;
import constant.milk.cashbook.util.MilkUtil;

public class SmsOutMoney 
{
	private int smsType; 
	private boolean flagATM = false;
//	private boolean flagHalbu = false;
//	private String halbuMonth = "0";
//	
//	private boolean FLAG = true;
	private boolean available = false;
//	
//	private boolean outmoneyFlag = false;
//	
//	//1:check 2:credit
	private int checkcreditFlag = 0;
//	
	private final int CHECK = 1;
	private final int CREDIT = 2;
//	
	private String message;
	private SmsInputData data;
//	
	private String date;
	
	public SmsOutMoney(){};
	
	public SmsOutMoney(SmsInputData data, String message, String date, int smsType, int checkcreditFlag)
	{
		this.data = data;
		this.message = message;
		this.date = date;
		this.smsType = smsType;
		this.checkcreditFlag = checkcreditFlag;
		
		outMoney();
	}
	
	public boolean getAvailable()
	{
		return available;
	}
	
	public SmsInputData getData()
	{
		return data;
	}
	
	public int getSmsType()
	{
		return smsType;
	}
	
	private void outMoney()
	{
		// 국민
		// BC
		// 현대
		// 신한
		
		if ( (data.getName().indexOf("KB국민카드") != -1) || (data.getName().indexOf("KB국민체크") != -1)
				 || (data.getName().indexOf("KB CMA체크") != -1) || (data.getName().indexOf("KB듀얼체크") != -1) 
				 || (data.getName().indexOf("KB체크신용") != -1) || (data.getName().indexOf("KB체크") != -1))
		{
			/*
			 * KB국민카드 7*0*
				정희경님
				09/11 18:31
				60,800원
				토이앤맘신림
				누적 2,878,609원
				
				KB국민카드 김태윤님 03/28 18:02 52,070원 (주)현대홈쇼핑승인
				
				KB국민카드 5*9*
				김희경님
				01/03 12:11
				15,000원
				탄
				누적 307,420원

				KB국민체크(2*0*)
				김남희님
				09/16 17:12
				9,800원
				카페민석씨 사용
				
				KB CMA체크
				###님
				01/24 20:32
				30,000원
				티켓몬스터 사용
				
				KB듀얼체크
				우선님
				01/23 12:36
				12,640원
				G마켓(1566-5701 스타샵 사용)
				
				KB체크신용 7*3*
				ㅇㅇㅇ님
				03/25 09:07
				31,000원
				시험원서접수
				누적 153,600원
				
				KB체크 7*3*
				###님
				05/20 00:00
				신용카드결제
				8,900원
				(주)롯데리아 엔
				누적 23,600원
				
				[KB국민체크]***님 교통대금 39,550원 10/05일 출금예정(10/04기준)
				
				[KB국민체크]윤미향님 교통대금 9,900원 01/18일 출금예정(01/17기준)
				
				[KB국민카드]한정은님 3*1*카드 01/15일 LGUPLUS 통신요금자동 42,290원 사용

				[KB국민카드]한정은님 2*1*카드 12/21일 KT통신료 33,930원 사용
				
				KB국민체크 김미경님 03/20 20:02 34,700원 옥션(1588-0184)(P1,051점사용)승인
				
			 */

			Pattern pName = Pattern.compile("(\\d\\*\\d\\*)");
			Matcher mName = pName.matcher(message);
			Pattern pName2 = Pattern.compile("님\\s+교통대금");
			Matcher mName2 = pName2.matcher(message);
			Pattern pName3 = Pattern.compile("KB CMA체크");
			Matcher mName3 = pName3.matcher(message);
			Pattern pName4 = Pattern.compile("KB듀얼체크");
			Matcher mName4 = pName4.matcher(message);
			Pattern pName5 = Pattern.compile("KB국민체크\\s+(.{2,4})님");
			Matcher mName5 = pName5.matcher(message);
			Pattern pName6 = Pattern.compile("KB국민카드\\s+(.{2,4})님\\s+");
			Matcher mName6 = pName6.matcher(message);
			Pattern pName7 = Pattern.compile("KB체크신용\\s+(.{2,4})님\\s+");
			Matcher mName7 = pName7.matcher(message);
			Pattern pName8 = Pattern.compile("KB체크\\s+(.{2,4})님\\s+");
			Matcher mName8 = pName8.matcher(message);
			//Pattern pMoney = Pattern.compile("\\d{2,}:\\d{2,}\\W*(\\d*,*\\d*,*\\d*,*\\d)");
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("(\\d{1,2}/\\d{1,2})");
			Matcher mDate = pDate.matcher(message);
			Pattern pDate2 = Pattern.compile("(\\d{1,2})/(\\d{1,2})일");
			Matcher mDate2 = pDate2.matcher(message);
			Pattern pMemo = Pattern.compile("\\d원\\s+(.+)\\s+누적");
			Matcher mMemo = pMemo.matcher(message);
			Pattern pMemo2 = Pattern.compile("\\d원\\s+(.+$)");
			Matcher mMemo2 = pMemo2.matcher(message);
			Pattern pMemo3 = Pattern.compile("원\\s+(\\d{1,2})/\\d{1,2}일\\s+출금");
			Matcher mMemo3 = pMemo3.matcher(message);
			Pattern pMemo4 = Pattern.compile("\\d{1,2}/\\d{1,2}일\\s+(.+\\s*.+)\\s+\\d");
			Matcher mMemo4 = pMemo4.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName(data.getName() + "(" + (mName.group(1)) + ")");
				}
			}
			else if (mName2.find())
			{
				data.setName("KB후불교통대금");
			}
			else if (mName3.find())
			{
				data.setName("KB CMA체크");
			}
			else if (mName4.find())
			{
				data.setName("KB듀얼체크");
			}
			else if (mName5.find())
			{
				data.setName("KB국민체크" + "(" + (mName5.group(1)) + ")");
			}
			else if (mName6.find())
			{
				data.setName("KB국민카드" + "(" + (mName6.group(1)) + ")");
			}
			else if (mName7.find())
			{
				data.setName("KB체크신용" + "(" + (mName7.group(1)) + ")");
			}
			else if (mName8.find())
			{
				data.setName("KB체크신용" + "(" + (mName8.group(1)) + ")");
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				if (mDate2.find())
				{
					data.setDate(date.substring(0, 4) + mDate2.group(1) + mDate2.group(2));
				}
				else
				{
					data.setDate(date);
				}
			}
			else if (mDate2.find())
			{
				data.setDate(calendar.get(Calendar.YEAR) + mDate2.group(1) + mDate2.group(2));
			}
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else if (mMemo3.find()) 
			{
				for (int i=0; i<mMemo3.groupCount(); i++) 
				{
					data.setMemo1("KB " + (mMemo3.group(1)+"월 후불교통대금"));
					data.setMemo2("KB " + (mMemo3.group(1)+"월 후불교통대금"));
					data.setMemo3("KB " + (mMemo3.group(1)+"월 후불교통대금"));
					data.setMemo4("KB " + (mMemo3.group(1)+"월 후불교통대금"));
				}
			}
			else if (mMemo4.find()) 
			{
				for (int i=0; i<mMemo4.groupCount(); i++) 
				{
					data.setMemo1((mMemo4.group(1)));
					data.setMemo2((mMemo4.group(1)));
					data.setMemo3((mMemo4.group(1)));
					data.setMemo4((mMemo4.group(1)));
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					data.setMemo1((mMemo2.group(1)));
					data.setMemo2((mMemo2.group(1)));
					data.setMemo3((mMemo2.group(1)));
					data.setMemo4((mMemo2.group(1)));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if ( data.getName().equalsIgnoreCase("KB인터넷뱅킹") )
		{
			/*
				
			 [KB인터넷뱅킹] 01/25 11:21 068210***0    출금 2,300,000원
			 */
			Pattern pName = Pattern.compile("(\\d{3,}\\*{1,6}\\d{1,})");
			Matcher mName = pName.matcher(message);
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)\\s+잔액");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pMoney2 = Pattern.compile("출금\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney2 = pMoney2.matcher(message);
			Pattern pMoney3 = Pattern.compile("결제\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney3 = pMoney3.matcher(message);
			Pattern pMoney4 = Pattern.compile("지급\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney4 = pMoney4.matcher(message);
			Pattern pMoney5 = Pattern.compile("출금이\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney5 = pMoney5.matcher(message);
			Pattern pMoney6 = Pattern.compile("CMS출\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney6 = pMoney6.matcher(message);
			Pattern pDate = Pattern.compile("([\\d]{2}[/][\\d]{2})");
			Matcher mDate = pDate.matcher(message);
//			Pattern pMemo = Pattern.compile("([^\\s]{2,})\\W*체\\s*크\\s*카\\s*드\\s*출\\s*금\\s*");	// 체크카드 출금 뒤
			//Pattern pMemo = Pattern.compile("\\*\\d+\\s+(.+)\\s+.+\\s+\\d*,*\\d*,*\\d*,*\\d\\s+잔액");
//			Pattern pMemo = Pattern.compile("\\*\\d+\\s+(.+\\s*.+)\\s+\\d*,*\\d*,*\\d*,*\\d\\s+잔액");
//			Matcher mMemo = pMemo.matcher(message);
//			Pattern pMemo2 = Pattern.compile("\\*\\d+\\s+(.+\\s*.+)\\s+\\d*,*\\d*,*\\d*,*\\d");
//			Matcher mMemo2 = pMemo2.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName("KB인터넷뱅킹" + "(" + (mName.group(1)) + ")");
				}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney2.find()) 
			{
				for (int i=0; i<mMoney2.groupCount(); i++) 
				{
					data.setMoney((mMoney2.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney3.find()) 
			{
				for (int i=0; i<mMoney3.groupCount(); i++) 
				{
					data.setMoney((mMoney3.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney4.find()) 
			{
				for (int i=0; i<mMoney4.groupCount(); i++) 
				{
					data.setMoney((mMoney4.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney5.find()) 
			{
				for (int i=0; i<mMoney5.groupCount(); i++) 
				{
					data.setMoney((mMoney5.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney6.find()) 
			{
				for (int i=0; i<mMoney6.groupCount(); i++) 
				{
					data.setMoney((mMoney6.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
//			if (mMemo.find()) 
//			{
//				for (int i=0; i<mMemo.groupCount(); i++) 
//				{
//					data.setMemo1((mMemo.group(1)));
//					data.setMemo2((mMemo.group(1)));
//					data.setMemo3((mMemo.group(1)));
//					data.setMemo4((mMemo.group(1)));
//				}
//			}
//			else if (mMemo2.find()) 
//			{
//				for (int i=0; i<mMemo2.groupCount(); i++) 
//				{
//					data.setMemo1((mMemo2.group(1)));
//					data.setMemo2((mMemo2.group(1)));
//					data.setMemo3((mMemo2.group(1)));
//					data.setMemo4((mMemo2.group(1)));
//				}
//			}
//			else
//			{
//				available = false;
//				return;
//			}
			
			data.setMemo1("KB인터넷뱅킹 출금");
			data.setMemo2("KB인터넷뱅킹 출금");
			data.setMemo3("KB인터넷뱅킹 출금");
			data.setMemo4("KB인터넷뱅킹 출금");
			
			available = true;
		}
		else if (data.getName().indexOf("KB") != -1)
		{
			/*
				
			 * 
			 * [KB]09/17 12:38 
			 * 623102**030 
			 * 이효준 
			 * 스마트폰출금 
			 * 123,123 
			 * 잔액456,789
			 * 
				[KB]10/24 13:19
				111111**111
				옥션
				쇼핑결제지급
				100,000			 
				
				[KB]01/23 12:33
				629210**419
				논공생활잡화
				체크카드출금
				17,900
				잔액885,044
				
				KB01/19 12:12
				910996**666
				ATM출금
				10,000
				잔액169,241
				
				[KB]01/23 20:02
				953177**857
				씨유중화제일
				체크카드출금
				2,600
				잔액 80,750
				
				[KB]01/23 14:23
				219402**321
				카드대금결제
				KC창구결제
				140,411
				
				[KB]01/15 00:56
				204202**777
				GS25
				체크카드출금
				2,500
				잔액240,000
				
				[KB]01/24 13:39
				596801**008
				쟝스헤어
				체크카드출금
				12,000
				
				[KB]01/24 11:32
				669501**461
				007097182002
				CD공동출금
				200,000
				잔액-2554,197
				
				[KB]06/22 17:05
				070102**123
				ZOOCOFFEEDAN
				체크카드출금
				3,900
				잔액29,343
				
			*/
			Pattern pName = Pattern.compile("(\\d{3,}\\*{1,6}\\d{1,})");
			Matcher mName = pName.matcher(message);
			//Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)\\s+");
//			Pattern pMoney = Pattern.compile("\\*\\d+\\s+.+\\s+(\\d*,*\\d*,*\\d*,*\\d)");
//			Matcher mMoney = pMoney.matcher(message);
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)\\s+잔액");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pMoney2 = Pattern.compile("출금\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney2 = pMoney2.matcher(message);
			Pattern pMoney3 = Pattern.compile("결제\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney3 = pMoney3.matcher(message);
			Pattern pMoney4 = Pattern.compile("지급\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney4 = pMoney4.matcher(message);
			Pattern pMoney5 = Pattern.compile("출금이\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney5 = pMoney5.matcher(message);
			Pattern pMoney6 = Pattern.compile("CMS출\\s+(\\d*,*\\d*,*\\d*,*\\d)");
			Matcher mMoney6 = pMoney6.matcher(message);
			Pattern pDate = Pattern.compile("([\\d]{2}[/][\\d]{2})");
			Matcher mDate = pDate.matcher(message);
//			Pattern pMemo = Pattern.compile("([^\\s]{2,})\\W*체\\s*크\\s*카\\s*드\\s*출\\s*금\\s*");	// 체크카드 출금 뒤
			//Pattern pMemo = Pattern.compile("\\*\\d+\\s+(.+)\\s+.+\\s+\\d*,*\\d*,*\\d*,*\\d\\s+잔액");
			Pattern pMemo = Pattern.compile("\\*\\d+\\s+(.+\\s*.+)\\s+\\d*,*\\d*,*\\d*,*\\d\\s+잔액");
			Matcher mMemo = pMemo.matcher(message);
			Pattern pMemo2 = Pattern.compile("\\*\\d+\\s+(.+\\s*.+)\\s+\\d*,*\\d*,*\\d*,*\\d");
			Matcher mMemo2 = pMemo2.matcher(message);
			Pattern pMemo3 = Pattern.compile("\\*\\d+\\s+(.+)\\s+체크카드출금\\s+\\d*,*\\d*,*\\d*,*\\d");
			Matcher mMemo3 = pMemo3.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName("KB" + "(" + (mName.group(1)) + ")");
				}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney2.find()) 
			{
				for (int i=0; i<mMoney2.groupCount(); i++) 
				{
					data.setMoney((mMoney2.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney3.find()) 
			{
				for (int i=0; i<mMoney3.groupCount(); i++) 
				{
					data.setMoney((mMoney3.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney4.find()) 
			{
				for (int i=0; i<mMoney4.groupCount(); i++) 
				{
					data.setMoney((mMoney4.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney5.find()) 
			{
				for (int i=0; i<mMoney5.groupCount(); i++) 
				{
					data.setMoney((mMoney5.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney6.find()) 
			{
				for (int i=0; i<mMoney6.groupCount(); i++) 
				{
					data.setMoney((mMoney6.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo3.find()) 
			{
				for (int i=0; i<mMemo3.groupCount(); i++) 
				{
					data.setMemo1((mMemo3.group(1)));
					data.setMemo2((mMemo3.group(1)));
					data.setMemo3((mMemo3.group(1)));
					data.setMemo4((mMemo3.group(1)));
				}
			}
			else if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					data.setMemo1((mMemo2.group(1)));
					data.setMemo2((mMemo2.group(1)));
					data.setMemo3((mMemo2.group(1)));
					data.setMemo4((mMemo2.group(1)));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if ( (data.getName().indexOf("기업BC") != -1) || (data.getName().indexOf("경남BC") != -1) || (data.getName().indexOf("대구BC") != -1)
				|| (data.getName().indexOf("씨티BC") != -1) || (data.getName().indexOf("스탠다드차타드BC") != -1)	 
				|| (data.getName().indexOf("우체국BC") != -1) || (data.getName().indexOf("신한BC") != -1)
				|| data.getName().equalsIgnoreCase("BC"))
		{
			/*
			 * 기업BC(1*6*)전진한님.09/25 06:04.일시불23,500원.누적금액913,431원.렉시편의점
			 * 
			 * [체크.승인]
				6,000원
				기업BC(9*4*)이지영님
				05/14 19:01
				통장잔액 100,000원
				
				[체크.승인]
				2,300원
				경남BC(6*3*)진해리님
				11/08 14:38
				통장잔액316,390원베로

				[일시불.승인]
				3,600원
				기업BC(5*2*)박지미님
				08/01 20:18
				코레일유통(주)경인지사
				
				기업BC(2*6*)김병기님(09/29 10:22)31,800원.255TOP적립예정.홈마트대곡점
				
				[체크.승인]
				3,300원
				씨티BC(9*4*)김성훈님
				12/04 18:41
				통장잔액297,200원오니기리와이규동
				
				[체크.승인]
				3,650원
				스탠다드차타드BC(9*5*)
				01/21 18:19
				통장잔액4,395원
				엘지마트
				
				[체크.승인]
				7,200원
				스탠다드차타드BC(4*9*)
				01/23 22:03
				피자스쿨(뚝섬역점)
				
				[체크.승인]
				99,000원
				우체국BC(0*9*)신경희님
				01/24 08:16
				이니시스
				
				[체크.승인]
				4,800원
				신한BC(8*0*)이지선님
				01/23 14:47
				무지개슈퍼
				
				스탠다드차타드BC(8*4*)정재한님.01/01 04:00.일시불10,180원.누적금액50,660원.T-money택시
				
				대구BC윤미향고객님 체크카드 후불교통요금 출금안내1/23결제금액11,000원(1/21기준)
				
				[일시불.승인]
				234,660원
				기업BC(4937)김성순님
				01/25 18:38
				인터파크_1588-1555_i
				
				[체크.승인]
				3,000원
				기업BC(6*1*)김던킨님
				01/27 14:17
				통장잔액-25,229,015원
				던킨도너츠
				
				[매출접수]216,670원 대구BC(3*7*)변상현님02월01일 한국전력전기요금수납
			 */
			
			Pattern pName = Pattern.compile("BC(\\(.{4}\\))");
			Matcher mName = pName.matcher(message);
			Pattern pName2 = Pattern.compile("고객님");
			Matcher mName2 = pName2.matcher(message);
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("(\\d{1,2}/\\d{1,2})");
			Matcher mDate = pDate.matcher(message);
			Pattern pDate2 = Pattern.compile("출금안내(\\d{1,2})/(\\d{1,2})결제금액");
			Matcher mDate2 = pDate2.matcher(message);
			Pattern pDate3 = Pattern.compile("님(\\d{1,2})월(\\d{1,2})일\\s+");
			Matcher mDate3 = pDate3.matcher(message);
			Pattern pMemo = Pattern.compile("\\d{2}:\\d{2}\\s+통장잔액-*\\d*,*\\d*,*\\d*,*\\d원\\s*(.+$)");
			Matcher mMemo = pMemo.matcher(message);
			Pattern pMemo2 = Pattern.compile("누적금액\\d*,*\\d*,*\\d*,*\\d원\\.(.+$)");
			Matcher mMemo2 = pMemo2.matcher(message);
			Pattern pMemo3 = Pattern.compile("님\\s+\\d{1,2}/\\d{1,2}\\s+\\d{2}:\\d{2}\\s+(.+$)");
			Matcher mMemo3 = pMemo3.matcher(message);
			Pattern pMemo4 = Pattern.compile("\\d*,*\\d*,*\\d*,*\\d원\\.[\\d*TOP적립예정\\.*]*(.+$)");
			Matcher mMemo4 = pMemo4.matcher(message);
			Pattern pMemo5 = Pattern.compile("(후불교통요금\\s+출금안내\\d{1,2}/\\d{1,2})결제금액");
			Matcher mMemo5 = pMemo5.matcher(message);
			Pattern pMemo6 = Pattern.compile("\\d{2}:\\d{2}\\s+(.+$)");
			Matcher mMemo6 = pMemo6.matcher(message);
			Pattern pMemo7 = Pattern.compile("님\\d{1,2}월\\d{1,2}일\\s+(.+$)");
			Matcher mMemo7 = pMemo7.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName(data.getName() + (mName.group(1)));
				}
			}
			else if (mName2.find())
			{
				data.setName(data.getName().substring(0, data.getName().indexOf("BC")+2) + "후불교통요금");
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				if (mDate2.find())
				{
					data.setDate(MilkUtil.getDateDB(Integer.parseInt(date.substring(0, 4)), Integer.parseInt(mDate2.group(1)), Integer.parseInt(mDate2.group(2))));
				}
				else if (mDate3.find())
				{
					data.setDate(MilkUtil.getDateDB(Integer.parseInt(date.substring(0, 4)), Integer.parseInt(mDate3.group(1)), Integer.parseInt(mDate3.group(2))));
				}
				else 
				{
					data.setDate(date);
				}	
			} 
			else if (mDate2.find())
			{
				data.setDate(calendar.get(Calendar.YEAR) + mDate2.group(1) + mDate2.group(2));
			}
			else if (mDate3.find())
			{
				data.setDate(calendar.get(Calendar.YEAR) + mDate3.group(1) + mDate3.group(2));
			}
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1(mMemo.group(1));
					data.setMemo2(mMemo.group(1));
					data.setMemo3(mMemo.group(1));
					data.setMemo4(mMemo.group(1));
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					data.setMemo1(mMemo2.group(1));
					data.setMemo2(mMemo2.group(1));
					data.setMemo3(mMemo2.group(1));
					data.setMemo4(mMemo2.group(1));
				}
			}
			else if (mMemo3.find()) 
			{
				for (int i=0; i<mMemo3.groupCount(); i++) 
				{
					data.setMemo1(mMemo3.group(1));
					data.setMemo2(mMemo3.group(1));
					data.setMemo3(mMemo3.group(1));
					data.setMemo4(mMemo3.group(1));
				}
			}
			else if (mMemo4.find()) 
			{
				for (int i=0; i<mMemo4.groupCount(); i++) 
				{
					data.setMemo1(mMemo4.group(1));
					data.setMemo2(mMemo4.group(1));
					data.setMemo3(mMemo4.group(1));
					data.setMemo4(mMemo4.group(1));
				}
			}
			else if (mMemo5.find()) 
			{
				for (int i=0; i<mMemo5.groupCount(); i++) 
				{
					data.setMemo1(mMemo5.group(1));
					data.setMemo2(mMemo5.group(1));
					data.setMemo3(mMemo5.group(1));
					data.setMemo4(mMemo5.group(1));
				}
			}
			else if (mMemo6.find()) 
			{
				for (int i=0; i<mMemo6.groupCount(); i++) 
				{
					data.setMemo1(mMemo6.group(1));
					data.setMemo2(mMemo6.group(1));
					data.setMemo3(mMemo6.group(1));
					data.setMemo4(mMemo6.group(1));
				}
			}
			else if (mMemo7.find()) 
			{
				for (int i=0; i<mMemo7.groupCount(); i++) 
				{
					data.setMemo1(mMemo7.group(1));
					data.setMemo2(mMemo7.group(1));
					data.setMemo3(mMemo7.group(1));
					data.setMemo4(mMemo7.group(1));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if (data.getName().indexOf("현대카드") != -1)
		{
			/*
			 * [현대카드M2]-승인
				52,700원(일시불)
				프라우산부인과의원
				누적액:1,002,400원
				
				[현대카드M]-승인
				김지영님
				08/14 08:44
				37,800원(일시불)
				승차권대금결제
				
				[현대카드M3]-승인
				이진*님
				4,080원(일시불)
				세븐일레븐포항효자S
				누적:929,810원
				
				[현대카드M]-승인
				김진*님
				88,730원(일시불)
				지자체세입금(인터넷
				누적:366,030원
			 */
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("([\\d]{2}[/][\\d]{2})");
			Matcher mDate = pDate.matcher(message);
			Pattern pMemo = Pattern.compile("\\d*,*\\d*,*\\d*,*\\d원\\s+(.+\\s*.+)\\s+누적");
			Matcher mMemo = pMemo.matcher(message);
			Pattern pMemo2 = Pattern.compile("\\s+([^\\s]*$)");
			Matcher mMemo2 = pMemo2.matcher(message);
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					data.setMemo1((mMemo2.group(1)));
					data.setMemo2((mMemo2.group(1)));
					data.setMemo3((mMemo2.group(1)));
					data.setMemo4((mMemo2.group(1)));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if ( (data.getName().indexOf("신한카드") != -1) || (data.getName().indexOf("신한체크") != -1) || (data.getName().indexOf("신한체크신용") != -1))
		{
			/*
			 * 
			 * 신한카드정상승인안익현님 08/25 16:21 21,860원(일시불) （주）지에스리
			 * 
			 * 
			 * 신한체크승인    08/31 16:34     2,400원         티머니택시      잔액     1,295원
				신한체크승인   09/03 19:14     17,000원        박승광손칼국수  잔액   344,798원
				［신한체크］08월 후불교통요금이　당일（매월３영업일）인출예정입니다 12,800원
				
				
				신한체크승인 10/04 09:15 2,600원 조아마트 잔액 157,418원[FW]
				신한체크승인    01/16 16:17     3,800원         (주)큰길  여산  잔액3,346,979원


				신한카드승인이정애님 10/30 18:18 100,000원(일시불) (주)에브리데 누적500,000원
				
				[신한카드]       유영혁님 01/25결제금액(01/17기준)  1,051,222원(결제:하나은행)
				[신한체크] 03월 후불교통이용대금          2,250원이 당일 인출예정입니다.
			 */
			
			Pattern pName = Pattern.compile("신한카드\\s+(.{2,6}님)");
			Matcher mName = pName.matcher(message);
			Pattern pName3 = Pattern.compile("신한체크신용");
			Matcher mName3 = pName3.matcher(message);
			Pattern pName2 = Pattern.compile("신한체크\\s+");
			Matcher mName2 = pName2.matcher(message);
			Pattern pName4 = Pattern.compile("신한체크\\]");
			Matcher mName4 = pName4.matcher(message);
			Pattern pName5 = Pattern.compile("신한카드\\]");
			Matcher mName5 = pName5.matcher(message);
			Pattern pName6 = Pattern.compile("신한카드\\]");
			Matcher mName6 = pName6.matcher(message);
			Pattern pName7 = Pattern.compile("신한체크카드\\s+");
			Matcher mName7 = pName7.matcher(message);
			Pattern pMoney = Pattern.compile("(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("(\\d{2}/\\d{2})");
			Matcher mDate = pDate.matcher(message);
			//Pattern pMemo = Pattern.compile("\\d원\\s+(.+)\\s+잔액");	// ???원 뒤에
			Pattern pMemo = Pattern.compile("\\d원\\s*\\n*\\s*\\n*(.+)\\s*\\n*\\s*\\n*잔액");	// ???원 뒤에
			Matcher mMemo = pMemo.matcher(message);
			//Pattern pMemo4 = Pattern.compile("\\d원\\s+(.+)\\s+누적");	// ???원 뒤에
			Pattern pMemo4 = Pattern.compile("\\d원\\s*\\n*\\s*\\n*(.+)\\s*\\n*\\s*\\n*누적");	// ???원 뒤에
			Matcher mMemo4 = pMemo4.matcher(message);
			Pattern pMemo2 = Pattern.compile("\\d원\\s*\\n*\\s*\\n*(.+$)");	// ???원 뒤에
			Matcher mMemo2 = pMemo2.matcher(message);
			Pattern pMemo3 = Pattern.compile("(\\d월 후불교통이용대금)");	// ???원 뒤에
			Matcher mMemo3 = pMemo3.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName(data.getName() + "(" + (mName.group(1)) + ")");
				}
			}
			else if (mName5.find())
			{
				for (int i=0; i<mName5.groupCount(); i++) 
				{
					data.setName(data.getName() + "(" + (mName5.group(1)) + ")");
				}
			}
			else if (mName3.find() || mName6.find() || mName7.find() )
			{
				//for (int i=0; i<mName3.groupCount(); i++) 
				//{
					data.setName("신한체크(신용)");
				//}
			}
			else if (mName2.find() || mName4.find())
			{
				//for (int i=0; i<mName2.groupCount(); i++) 
				//{
					data.setName("신한체크(체크)");
				//}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
				available = true;
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)).replaceAll("\\n", "").trim());
					data.setMemo2((mMemo.group(1)).replaceAll("\\n", "").trim());
					data.setMemo3((mMemo.group(1)).replaceAll("\\n", "").trim());
					data.setMemo4((mMemo.group(1)).replaceAll("\\n", "").trim());
				}
			}
			else if (mMemo4.find()) 
			{
				for (int i=0; i<mMemo4.groupCount(); i++) 
				{
					data.setMemo1((mMemo4.group(1)).replaceAll("\\n", "").trim());
					data.setMemo2((mMemo4.group(1)).replaceAll("\\n", "").trim());
					data.setMemo3((mMemo4.group(1)).replaceAll("\\n", "").trim());
					data.setMemo4((mMemo4.group(1)).replaceAll("\\n", "").trim());
				}
			}
			else if (mMemo3.find()) 
			{
				for (int i=0; i<mMemo3.groupCount(); i++) 
				{
					data.setMemo1((mMemo3.group(1)).replaceAll("\\n", "").trim());
					data.setMemo2((mMemo3.group(1)).replaceAll("\\n", "").trim());
					data.setMemo3((mMemo3.group(1)).replaceAll("\\n", "").trim());
					data.setMemo4((mMemo3.group(1)).replaceAll("\\n", "").trim());
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					data.setMemo1((mMemo2.group(1)).replaceAll("\\n", "").trim());
					data.setMemo2((mMemo2.group(1)).replaceAll("\\n", "").trim());
					data.setMemo3((mMemo2.group(1)).replaceAll("\\n", "").trim());
					data.setMemo4((mMemo2.group(1)).replaceAll("\\n", "").trim());
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if ( (data.getName().indexOf("신한은행") != -1) )
		{
			/*
			 * 
			 * [신한은행]
				09월05일21시45분
				[110-***-122714]
				지급 30,000원
				(정혜진)
			 */
			
			Pattern pName = Pattern.compile("\\[(\\d{2,}-.{2,}-.{2,})\\]");
			Matcher mName = pName.matcher(message);
			Pattern pMoney = Pattern.compile("\\s+(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("(\\d{1,2})월(\\d{1,2})일");
			Matcher mDate = pDate.matcher(message);
			Pattern pMemo = Pattern.compile("\\d*,*\\d*,*\\d*,*\\d원\\s+(.+$)");
			Matcher mMemo = pMemo.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName("신한은행" + "(" + (mName.group(1)).replaceAll("-", "") + ")");
				}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR) + (mDate.group(1)) + (mDate.group(2)));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else
			{
				available = false;
				return;
			}
			
//			data.setMemo1("현금 출금");
//			data.setMemo2("현금 출금");
//			data.setMemo3("현금 출금");
//			data.setMemo4("현금 출금");
//			
//			smsType = BDConstents.OUT_ATM_SMS;
			
			available = true;
		}
		else if ( (data.getName().equalsIgnoreCase("신한i")) || (data.getName().equalsIgnoreCase("신한 i")) )
		{
			/*
			 * [신한i]056 111 ***09    01032459872k   출금 29954원  최종 0원
			 * 
			 * [신한 i] 063111***40 은행이체 출금 2,000,000원 최종 4,751,861원
			 */
			
			Pattern pName = Pattern.compile("(\\d{2,}\\s+\\d{2,})");
			Matcher mName = pName.matcher(message);
			Pattern pName2 = Pattern.compile("(\\d{2,}\\*{2,}\\d{2,})");
			Matcher mName2 = pName2.matcher(message);
			Pattern pMoney = Pattern.compile("출금\\s+(\\d{1,})원");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pMoney2 = Pattern.compile("출금\\s+(\\d*,*\\d*,*\\d*,*\\d)원");
			Matcher mMoney2 = pMoney2.matcher(message);
			Pattern pDate = Pattern.compile("(\\d{1,2}/\\d{1,2})");
			Matcher mDate = pDate.matcher(message);
			Pattern pMemo = Pattern.compile("\\*\\d{1,}\\s+(.+\\s*.+)\\s+출금");
			Matcher mMemo = pMemo.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName("신한i" + "(" + mName.group(1).replaceAll("\\s", "") + ")");
				}
			}
			else if (mName2.find())
			{
				for (int i=0; i<mName2.groupCount(); i++) 
				{
					data.setName("신한i" + "(" + mName2.group(1).replaceAll("\\s", "") + ")");
				}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else if (mMoney2.find()) 
			{
				for (int i=0; i<mMoney2.groupCount(); i++) 
				{
					data.setMoney((mMoney2.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		else if (data.getName().indexOf("신한") != -1)
		{
			/*
			 * 신한01/16 08:07
				110-***-245287
				출금 4,600
				잔액 87,501
				씨유연남경성점
			 */
			Pattern pName = Pattern.compile("\\d{2}:\\d{2}\\s+(.+)\\s+출금");
			Matcher mName = pName.matcher(message);
			Pattern pMoney = Pattern.compile("출금\\s+(\\d*,*\\d*,*\\d*,*\\d)\\s+");
			Matcher mMoney = pMoney.matcher(message);
			Pattern pDate = Pattern.compile("([\\d]{2}[/][\\d]{2})");
			Matcher mDate = pDate.matcher(message);
			Pattern pMemo = Pattern.compile("잔액\\s+-*\\d*,*\\d*,*\\d*,*\\d\\s+(.+)");
			Matcher mMemo = pMemo.matcher(message);
			Pattern pMemo2 = Pattern.compile("출금\\s+\\d*,*\\d*,*\\d*,*\\d\\s+(.+)");
			Matcher mMemo2 = pMemo2.matcher(message);
			
			if (mName.find())
			{
				for (int i=0; i<mName.groupCount(); i++) 
				{
					data.setName("신한" + "(" + (mName.group(1).replaceAll("-", "")) + ")");
				}
			}
			else
			{
				available = false;
				return;
			}
			
			if (mMoney.find()) 
			{
				for (int i=0; i<mMoney.groupCount(); i++) 
				{
					data.setMoney((mMoney.group(1).replaceAll(",", "")));
				}
			}
			else
			{
				available = false;
				return;
			}
			
			Calendar calendar = Calendar.getInstance();
			if (date != null && date.length() > 0)
			{
				data.setDate(date);
			} 
			else if (mDate.find()) 
			{
				for (int i=0; i<mDate.groupCount(); i++) 
				{
					data.setDate(calendar.get(Calendar.YEAR)+(mDate.group(1).replaceAll("/", "")));
				}
			}
			else
			{
				data.setDate(MilkUtil.getDateDB(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH)));
				//originalParsing();
			}
			
			if (mMemo.find()) 
			{
				for (int i=0; i<mMemo.groupCount(); i++) 
				{
					data.setMemo1((mMemo.group(1)));
					data.setMemo2((mMemo.group(1)));
					data.setMemo3((mMemo.group(1)));
					data.setMemo4((mMemo.group(1)));
				}
			}
			else if (mMemo2.find()) 
			{
				for (int i=0; i<mMemo2.groupCount(); i++) 
				{
					String memo = "내용 없음";
					if ( ! (mMemo2.group(1) != null) && (mMemo2.group(1).indexOf("잔액") == -1) )
					{
						memo = mMemo2.group(1);
					}
					data.setMemo1(memo);
					data.setMemo2(memo);
					data.setMemo3(memo);
					data.setMemo4(memo);
				}
			}
			else
			{
				available = false;
				return;
			}
			
			available = true;
		}
		
		
		
		if (data.getName() == null || data.getName().equalsIgnoreCase(""))
		{
			SmsOutMoney2 som2 = new SmsOutMoney2(data, message, date, smsType, checkcreditFlag);
			this.data = som2.getData();
			this.smsType = som2.getSmsType();
			this.available = som2.getAvailable();
		}
		if (data.getDate() == null || data.getDate().equalsIgnoreCase(""))
		{
			SmsOutMoney2 som2 = new SmsOutMoney2(data, message, date, smsType, checkcreditFlag);
			this.data = som2.getData();
			this.smsType = som2.getSmsType();
			this.available = som2.getAvailable();
		}
		if (data.getMoney() == null || data.getMoney().equalsIgnoreCase(""))
		{
			SmsOutMoney2 som2 = new SmsOutMoney2(data, message, date, smsType, checkcreditFlag);
			this.data = som2.getData();
			this.smsType = som2.getSmsType();
			this.available = som2.getAvailable();
		}
		if ( (data.getMemo1() == null) || (data.getMemo1().equalsIgnoreCase("")) 
				&& ( (data.getMemo2() == null) || (data.getMemo2().equalsIgnoreCase("")) )
				&& ( (data.getMemo3() == null) || (data.getMemo3().equalsIgnoreCase("")) )
				&& ( (data.getMemo4() == null) || (data.getMemo4().equalsIgnoreCase("")) ) )
		{
			SmsOutMoney2 som2 = new SmsOutMoney2(data, message, date, smsType, checkcreditFlag);
			this.data = som2.getData();
			this.smsType = som2.getSmsType();
			this.available = som2.getAvailable();
		}
		if (data.getName() == null || data.getName().equalsIgnoreCase("") 
				|| data.getDate() == null || data.getDate().equalsIgnoreCase("") 
				|| data.getMoney() == null || data.getMoney().equalsIgnoreCase("")
				|| ( data.getMemo1() == null || data.getMemo1().equalsIgnoreCase("") 
				&& data.getMemo2() == null || data.getMemo2().equalsIgnoreCase("")
				&& data.getMemo3() == null || data.getMemo3().equalsIgnoreCase("")
				&& data.getMemo4() == null || data.getMemo4().equalsIgnoreCase("") ) )
		{
			this.available = false;
			return;
		}
		
		
//		공백 및 라인 내려가는 곳 처리
//		(ex) 출금\\s*\\n*\\s*\\n*누적

//		공백 및 라인 내려가는 곳 사이에
//		(ex) 출금\\s*\\n*\\s*\\n*(.+)\\s*\\n*\\s*\\n*누적
		
//		공백 및 라인 내려가는 곳 뒤에서 끝까지
//		(ex) \\d원\\s*\\n*\\s*\\n*(.+$)
		
//		data.setMemo1((mMemo.group(1)).replaceAll("\\n", "").trim());
//		data.setMemo2((mMemo.group(1)).replaceAll("\\n", "").trim());
//		data.setMemo3((mMemo.group(1)).replaceAll("\\n", "").trim());
//		data.setMemo4((mMemo.group(1)).replaceAll("\\n", "").trim());
	}
}
